/*
 * Copyright (c) 2016. zhaojin 15398699939@163.com
 */

package com.bankscene.screenfit;

import android.app.Application;
import android.content.Context;
import android.support.annotation.CheckResult;
import android.support.annotation.NonNull;

import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;

/**
 * Created by jiiiiiin on 6/14/16.
 */
public class App extends Application {

    private RefWatcher refWatcher;
    private boolean isPad;
    private static App INSTANCE;

    @Override
    public void onCreate() {
        super.onCreate();
        INSTANCE = this;
        refWatcher = LeakCanary.install(this);
//        ButterKnife.setDebug(BuildConfig.DEBUG);//Control whether debug logging is enabled.
    }

    @CheckResult
    public static RefWatcher getReWatcher(@NonNull Context context){
        App application = (App) context.getApplicationContext();
        return application.getRefWatcher();
    }

    @CheckResult
    public RefWatcher getRefWatcher() {
        return refWatcher;
    }

    @CheckResult
    public boolean isPad() {
        return isPad;
    }

    public void setPad(@NonNull boolean pad) {
        isPad = pad;
    }

    @CheckResult
    public static App getInstance() {
        return INSTANCE;
    }

}
